package com.jy.wms.common.base;

import org.jeecgframework.poi.handler.impl.ExcelDataHandlerDefaultImpl;

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Map;

/**
 * 协助发货上传EXCEL 辅助文件
 */
public class AssistDeliveryMapImportHanlder extends ExcelDataHandlerDefaultImpl {
    @Override
    public void setMapValue(Map<String, Object> map, String originKey, Object value) {
        System.out.print("value:" + value);
        if (value instanceof Double) {
            NumberFormat nf = new DecimalFormat("#");
            value = nf.format(value);
        }
        if(originKey != null){
            map.put(getRealKey(originKey), value != null ? value.toString() : null);
        }
    }

    private String getRealKey(String originKey) {
        if (originKey.equals("发起部门")) {return "fqbm";}
        if (originKey.equals("发起人")) { return "fqr";}
        if (originKey.equals("订单类型")) {return "yt";}
        if (originKey.equals("流水号")) {return "lsh";}
        if (originKey.equals("订单号")) {return "ddh";}
        if (originKey.equals("等待合并发运单号")) {return "ddhbfydh";}
        if (originKey.equals("发货方式")) {return "fhfs";}
        if (originKey.equals("运费承担方")) {return "yfcdf";}
        if (originKey.equals("收货人姓名")) {return "shrxm";}
        if (originKey.equals("收货人国家")) {return "shrgj";}
        if (originKey.equals("省份")) {return "sf";}
        if (originKey.equals("城市")) {return "cs";}
        if (originKey.equals("县区")) {return "xq";}
        if (originKey.equals("收货地址")) {return "shdz";}
        if (originKey.equals("联系电话")) {return "lxdh";}
        if (originKey.equals("发起日期")) {return "fqrq";}
        if (originKey.equals("支付日期")) {return "zfrq";}
        if (originKey.equals("服务编号")) {return "fwbh";}
        if (originKey.equals("产品名称")) {return "cpmc";}
        if (originKey.equals("数量")) {return "sl";}
        if (originKey.equals("规格")) {return "gg";}
        if (originKey.equals("单位")) {return "dw";}
        if (originKey.equals("产品类别")) {return "cplb";}
        if (originKey.equals("单价")) {return "dj";}
        if (originKey.equals("特定物流单号")) {return "tdwldh";}
        if (originKey.equals("货号")) {return "hh";}
        if (originKey.equals("发货摘要")) {return "fhzy";}
        if (originKey.equals("备注")) {return "bz";}
        return "";
    }
}
